const validator = (rules) => {
    return async (ctx, next) => {
        try {
            ctx.verifyParams(rules);
        } catch (err) {
            console.log(err);
            ctx.body = {
                error: '上传数据格式错误或漏传数据,请检查后重新上传'
            }
            return
        }
        await next();
    }
}

module.exports = { validator };